<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/jsps/baseTaglibJsp.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<title>公告列表</title>
		<script type="text/javascript" src="<%=path%>/js/jquery-1.8.3.min.js"></script>
		<link rel="stylesheet" type="text/css"
			href="<%=path%>/plugin/jquery-easyui-1.2.4/themes/gray/easyui.css" />
		<link rel="stylesheet" type="text/css"
			href="<%=path%>/plugin/jquery-easyui-1.2.4/themes/icon.css" />
		<link rel="stylesheet" type="text/css"
			href="<%=path%>/css/Default.css" />
		<script type="text/javascript"
			src="<%=path%>/plugin/jquery-easyui-1.2.4/jquery.easyui.min.js"></script>
		<script type="text/javascript"
			src="<%=path%>/plugin/jquery-easyui-1.2.4/locale/easyui-lang-zh_CN.js"></script>
		<script type="text/javascript">
	$(function() {
		$('#placardGrid')
				.datagrid(
						{
							title : '公告管理',
							iconCls : 'tu0104',
							width : 'auto',
							height : 600,
							nowrap : true,
							striped : true,
							collapsible : true,
							singleSelect : true,
							url : 'lcd/placard!list',
							idField : 'placardID',

							toolbar : [ {
								text : "发布",
								iconCls : "icon-add",
								handler : function() {
									window.location.href = "lcd/placard!toCreate";
									return false;
								}
							} ],
							columns : [ [
									{
										field : 'title',
										title : '公告标题',
										width : 100,
										align : 'center'
									},
									{
										field : 'content',
										title : '公告内容',
										width : 300,
										align : 'center'
									},
									{
										field : 'closeTime',
										title : '截止时间',
										width : 240,
										align : 'center'
									},
									{
										field : 'status',
										title : '状态',
										width : 100,
										align : 'center',
										formatter : function(val, rec) {
											if (val == 0) {
												return "未审核";
											} else if (val == 1) {
												return "审核通过";
											} else {
												return "审核未通过";
											}
										}
									},
									{
										field : 'placardID',
										title : '操作',
										width : 200,
										align : 'center',
										formatter : function(val, rec) {
											return "<a href='javascript:edit("
													+ val
													+ ");'>修改</a>          <a href='javascript:remove("
													+ val
													+ ");'>删除</a>";
										}
									} ] ],
							pagination : true,
							rownumbers : true
						});
	});

	function remove(id) {
		$.messager.confirm('刪除提示', '确定删除?', function(r) {
			if (r) {
				$.ajax({
					url : "lcd/placard!remove", 
					data : "placardID=" + id + "&mark=" + Math.random(),
					success : function(data) {
                       if(data = "succ"){
                          $.messager.alert('提示','删除成功'); 
                          $("#placardGrid").datagrid("reload");
                       }
					}
				});
			}
		});
    }
</script>
	</head>

	<body>
		<table id="placardGrid"></table>
	</body>
</html>
